<!--
 * @FileDescription 毫米波雷达标定界面 - 右侧标定分类选择
 * @Author 杨宇翔
 * @Date 20220528 09:36:48
 * @LastEditors 杨宇翔
 * @LastEditTime 20220528 09:36:48
-->
<template>
    <div class="calibration-sidebar">
        <i></i>
        <button class="reset" type="button" @click="OnChanged">
            <!-- <img
                :src="state ? `/static/InertialNavigation/ic_zhankai.png` : `/static/InertialNavigation/ic_shouqi.png`"> -->
            <span>标定项目</span>
        </button>
        <template v-for="[id, config] of CalibrationComponent.Default.Configs" :key="id">
            <input type="radio" name="标定模块" :id="'标定模块' + id" :value="id"
                v-model="CalibrationComponent.Default.Id.value" hidden>
            <label :for="'标定模块' + id">
                <span>{{ config.Name }}</span>
                <span></span>
            </label>
        </template>
    </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { CalibrationComponent } from './InertialNavigationComponent';

const state = ref(true);

const sidebarTranslateX = ref('translateX(0)');
const buttonTranslateX = ref('translateX(0)');

function OnChanged() {
    state.value = !state.value;
    sidebarTranslateX.value = state.value ? 'translateX(0)' : 'translateX(100%)';
    buttonTranslateX.value = state.value ? 'translateX(0)' : 'translateX(-6rem)';
}
</script>

<style scoped>
.calibration-sidebar {
    position: absolute;
    right: 0;
    top: 13rem;

    display: flex;
    flex-direction: column;
    justify-content: stretch;
    gap: 1rem;

    padding-bottom: 1rem;

    background-color: #131620;

    border-radius: 2rem 0 0 2rem;

    transform: v-bind(sidebarTranslateX);

    transition: transform 300ms;
}

button {
    width: 100%;
    height: 5rem;

    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 1.4rem;

    padding: 0 2.4rem;

    background-color: #131620;

    border-radius: 2.5rem 0 0 2.5rem;
    box-shadow: inset 0 -0.1rem 0 0 #1F1F2D;

    transform: v-bind(buttonTranslateX);

    transition: transform 300ms;

    cursor: pointer;
}

button>span:first-of-type {
    color: #B1B1D4;
    font-size: 1.8rem;
    font-weight: 500;
}

i {
    position: absolute;
    left: 0;
    bottom: 0;

    display: block;
    width: 100%;
    height: calc(100% - 6rem);

    border-left: solid 0.6rem transparent;
    border-bottom: solid 0.6rem transparent;
    border-radius: 0 0 0 2rem;
    background-image: linear-gradient(#131620, #131620),
        linear-gradient(90deg, #218cde, #807de1);
    background-origin: border-box;
    background-clip: content-box, border-box;

    z-index: -1;
}

label {
    width: 100%;
    height: 5.4rem;

    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;

    gap: 1rem;

    padding-left: 2rem;

    border-radius: 1rem;
}

label>span {
    color: #81859C;
    font-size: 1.6rem;
    font-weight: 500;

    white-space: nowrap;
}

input:checked+label>span {
    color: white;
    font-weight: 500;

    background: linear-gradient(90deg, #218CDE 0%, #807DE1 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

input:hover+label>span {
    color: white;
}

label>span:last-of-type {
    display: block;
    width: 0.4rem;
    height: 2rem;
}

input:checked+label>span:last-of-type {
    border-radius: 0.2rem;
    background: linear-gradient(180deg, #807DE1 0%, #218CDE 100%);
}
</style>